Make gdk_window_process_[all]_updates() respect update_freeze_counter
authorMatthias Clasen <mclasen@redhat.com>
Thu, 26 Aug 2004 14:09:08 +0000 (14:09 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 26 Aug 2004 14:09:08 +0000 (14:09 +0000)
2004-08-26  Matthias Clasen  <mclasen@redhat.com>

Make gdk_window_process_[all]_updates() respect
update_freeze_counter  (#144272, Soeren Sandmann)

* gdk/gdkwindow.c (gdk_window_schedule_update): New function to
install an idle for gdk_window_update_idle() if one isn't there
already.
(gdk_window_process_all_updates):
(gdk_window_process_updates): Only process the updates if the
window isn't frozen.
(gdk_window_invalidate_maybe_recurse): Schedule an update when
necessary.
(gdk_window_thaw_updates): Use gdk_window_schedule_update() instead
of directly installing the idle.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/gdkwindow.c

index 37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf..e6923bfac5151985ebcfdeb96da42eff81158a50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2004-08-26  Matthias Clasen  <mclasen@redhat.com>
+
+       Make gdk_window_process_[all]_updates() respect 
+       update_freeze_counter  (#144272, Soeren Sandmann)
+       
+       * gdk/gdkwindow.c (gdk_window_schedule_update): New function to
+       install an idle for gdk_window_update_idle() if one isn't there
+       already.
+       (gdk_window_process_all_updates): 
+       (gdk_window_process_updates): Only process the updates if the
+       window isn't frozen.
+       (gdk_window_invalidate_maybe_recurse): Schedule an update when
+       necessary.
+       (gdk_window_thaw_updates): Use gdk_window_schedule_update() instead
+       of directly installing the idle.
+
 2004-08-22  Robert Ögren  <gtk@roboros.com>
 
        On Win32, make graphical tablets work on multi-monitor systems.
index 37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf..e6923bfac5151985ebcfdeb96da42eff81158a50 100644 (file)
@@ -1,3 +1,19 @@
+2004-08-26  Matthias Clasen  <mclasen@redhat.com>
+
+       Make gdk_window_process_[all]_updates() respect 
+       update_freeze_counter  (#144272, Soeren Sandmann)
+       
+       * gdk/gdkwindow.c (gdk_window_schedule_update): New function to
+       install an idle for gdk_window_update_idle() if one isn't there
+       already.
+       (gdk_window_process_all_updates): 
+       (gdk_window_process_updates): Only process the updates if the
+       window isn't frozen.
+       (gdk_window_invalidate_maybe_recurse): Schedule an update when
+       necessary.
+       (gdk_window_thaw_updates): Use gdk_window_schedule_update() instead
+       of directly installing the idle.
+
 2004-08-22  Robert Ögren  <gtk@roboros.com>
 
        On Win32, make graphical tablets work on multi-monitor systems.
index 37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf..e6923bfac5151985ebcfdeb96da42eff81158a50 100644 (file)
@@ -1,3 +1,19 @@
+2004-08-26  Matthias Clasen  <mclasen@redhat.com>
+
+       Make gdk_window_process_[all]_updates() respect 
+       update_freeze_counter  (#144272, Soeren Sandmann)
+       
+       * gdk/gdkwindow.c (gdk_window_schedule_update): New function to
+       install an idle for gdk_window_update_idle() if one isn't there
+       already.
+       (gdk_window_process_all_updates): 
+       (gdk_window_process_updates): Only process the updates if the
+       window isn't frozen.
+       (gdk_window_invalidate_maybe_recurse): Schedule an update when
+       necessary.
+       (gdk_window_thaw_updates): Use gdk_window_schedule_update() instead
+       of directly installing the idle.
+
 2004-08-22  Robert Ögren  <gtk@roboros.com>
 
        On Win32, make graphical tablets work on multi-monitor systems.
index 37dbd4e3d2b6687e39754f1f55d0bd3bb1dc26bf..e6923bfac5151985ebcfdeb96da42eff81158a50 100644 (file)
@@ -1,3 +1,19 @@
+2004-08-26  Matthias Clasen  <mclasen@redhat.com>
+
+       Make gdk_window_process_[all]_updates() respect 
+       update_freeze_counter  (#144272, Soeren Sandmann)
+       
+       * gdk/gdkwindow.c (gdk_window_schedule_update): New function to
+       install an idle for gdk_window_update_idle() if one isn't there
+       already.
+       (gdk_window_process_all_updates): 
+       (gdk_window_process_updates): Only process the updates if the
+       window isn't frozen.
+       (gdk_window_invalidate_maybe_recurse): Schedule an update when
+       necessary.
+       (gdk_window_thaw_updates): Use gdk_window_schedule_update() instead
+       of directly installing the idle.
+
 2004-08-22  Robert Ögren  <gtk@roboros.com>
 
        On Win32, make graphical tablets work on multi-monitor systems.
index 3e6a3112ef78e6b2fe62daba0d2b2ac23e28d41b..089a434a72fcbdd55995dc869842a29ba1f8d5f7 100644 (file)
@@ -1987,11 +1987,33 @@ gdk_window_copy_to_image (GdkDrawable     *drawable,
 
 /* Code for dirty-region queueing
  */
-
 static GSList *update_windows = NULL;
 static guint update_idle = 0;
 static gboolean debug_updates = FALSE;
 
+static gboolean
+gdk_window_update_idle (gpointer data)
+{
+  GDK_THREADS_ENTER ();
+  gdk_window_process_all_updates ();
+  GDK_THREADS_LEAVE ();
+  
+  return FALSE;
+}
+
+static void
+gdk_window_schedule_update (GdkWindow *window)
+{
+  if (window && GDK_WINDOW_OBJECT (window)->update_freeze_count)
+    return;
+
+  if (!update_idle)
+    {
+      update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
+                                    gdk_window_update_idle, NULL, NULL);
+    }
+}
+
 static void
 gdk_window_process_updates_internal (GdkWindow *window)
 {
@@ -2111,7 +2133,13 @@ gdk_window_process_all_updates (void)
   
   while (tmp_list)
     {
-      gdk_window_process_updates_internal (tmp_list->data);
+      GdkWindowObject *private = (GdkWindowObject *)tmp_list->data;
+      
+      if (private->update_freeze_count)
+       update_windows = g_slist_prepend (update_windows, private);
+      else
+       gdk_window_process_updates_internal (tmp_list->data);
+      
       g_object_unref (tmp_list->data);
       tmp_list = tmp_list->next;
     }
@@ -2121,16 +2149,6 @@ gdk_window_process_all_updates (void)
   flush_all_displays ();
 }
 
-static gboolean
-gdk_window_update_idle (gpointer data)
-{
-  GDK_THREADS_ENTER ();
-  gdk_window_process_all_updates ();
-  GDK_THREADS_LEAVE ();
-  
-  return FALSE;
-}
-
 /**
  * gdk_window_process_updates:
  * @window: a #GdkWindow
@@ -2155,7 +2173,7 @@ gdk_window_process_updates (GdkWindow *window,
   g_return_if_fail (window != NULL);
   g_return_if_fail (GDK_IS_WINDOW (window));
   
-  if (private->update_area)
+  if (private->update_area && !private->update_freeze_count)
     {      
       gdk_window_process_updates_internal (window);
       update_windows = g_slist_remove (update_windows, window);
@@ -2300,9 +2318,7 @@ gdk_window_invalidate_maybe_recurse (GdkWindow *window,
          update_windows = g_slist_prepend (update_windows, window);
          private->update_area = gdk_region_copy (visible_region);
          
-         if (!private->update_freeze_count && !update_idle)
-           update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
-                                          gdk_window_update_idle, NULL, NULL);
+         gdk_window_schedule_update (window);
        }
       
       if (child_func)
@@ -2474,10 +2490,8 @@ gdk_window_thaw_updates (GdkWindow *window)
   g_return_if_fail (GDK_IS_WINDOW (window));
   g_return_if_fail (private->update_freeze_count > 0);
 
-  private->update_freeze_count--;
-  if (!private->update_freeze_count && private->update_area && !update_idle)
-    update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
-                                  gdk_window_update_idle, NULL, NULL);
+  if (--private->update_freeze_count == 0)
+    gdk_window_schedule_update (window);
 }
 
 /**